﻿@model MvcApplication6.Models.NewModel
@using MvcApplication6.Models
@using MvcPaging
@using MvcApplication6.common
@if (Model.TotalRecord > 0) 
{
    if(Model.EventListModel.Count > 0)
    {
            <div class="pr-head">
            
                  <span>@Model.Title</span>
                   @if (Session["checkLoginAbcuser"] != null)
                  { 
                        @*<a  href="Admin/AddNews_2?CategoryEventId=@Model.CategoryId" >Thêm @Model.Title</a>*@
                       
                        @Html.ActionLink("|Thêm" + @Model.Title,
                            "AddNews_2",   // <-- ActionMethod
                         "Admin",  // <-- Controller Name.
                         new
                         {
                             CategoryEventId = @Model.CategoryId
                         }, // <-- Route arguments.
                         null
                         )
                  }
                  <div class="clear"></div>  
            
                <ul class="list1">
                    @foreach (var eventModel in Model.EventListModel)
                    {
                        <li>
                            @*<img src=../../Upload/Images/@eventModel.Image alt="" />*@
                            @*@Ajax.ImageActionLink(
                                     "http://aptechpro.vn/Upload/Images/" + @eventModel.Image,
                                    "",
                                    "NewDetail",
                                    new
                                    {
                                        Id = @eventModel.Id
                                    },
                                    new AjaxOptions
                                    {
                                        HttpMethod = "GET",
                                        InsertionMode = InsertionMode.Replace,
                                        UpdateTargetId = "listProduct",
                                        OnSuccess = "myonsuccessCallServer"
                                    }
                                )*@
                            <a href="/Home/NewDetail/@eventModel.Title.Replace(" ", "")/@eventModel.Id">
                                <img  src="http://aptechpro.vn/Upload/Images/@eventModel.Image"/>
                            </a>
                         <div class="zoom">
                      @*   @Ajax.ActionLink(
                            @eventModel.Title,
                            "NewDetail",
                            new
                            {
                                Id = @eventModel.Id
                            },
                            new AjaxOptions
                            {
                                HttpMethod = "GET",
                                InsertionMode = InsertionMode.Replace,
                                UpdateTargetId = "listProduct",
                                OnSuccess = "myonsuccessCallServer"
                            }
                            )*@
                             <a href="/Home/NewDetail/@eventModel.Title.Replace(" ", "")/@eventModel.Id">
                                 @eventModel.Title
                             </a>
                         <br />
                         <p>@eventModel.Title2</p>
                         </div>

                         @if (Session["checkLoginAbcuser"] != null)
                         { 
                             @*<a  href="/Admin/AddNews?EventId=@eventModel.Id">|Sửa</a> *@
                             
                            @Html.ActionLink("|Sửa",
                                                "AddNews",   // <-- ActionMethod
                                                "Admin",  // <-- Controller Name.
                                                new
                                                {
                                                    EventId = @eventModel.Id
                                                }, // <-- Route arguments.
                                                null
                                                )

                             
                            @Ajax.ActionLink(
                                "|Xóa",
                                "DeleteNew",
                                new
                                {
                                    Id = @eventModel.Id,
                                    page = @Model.CurrentPage,
                                    IdCe = @Model.CategoryId

                                },
                                new AjaxOptions
                                {
                                    HttpMethod = "GET",
                                    InsertionMode = InsertionMode.Replace,
                                    UpdateTargetId = "listProduct",
                                    OnBegin = "myonbegin",
                                    OnSuccess = "myonsuccess",
                                    OnFailure = "myonfailure"
                                }
                                )

                         }
                         </li>
                    
                    }

                    




                     
                </ul>


                @if (Model.TotalRecord > 0)
                { 
                    <ul>
                    @Html.Raw(Ajax.Pager(
                            new Options
                            {
                                PageSize = 6,
                                TotalItemCount = Model.TotalRecord,
                                CurrentPage = Model.CurrentPage,
                                ItemTexts = new ItemTexts() { Next = "Next", Previous = "Previous", Page = "P" },
                                ItemIcon = new ItemIcon() { First = "icon-backward", Previous = "icon-chevron-left", Next = "icon-chevron-right", Last = "icon-forward" },
                                TooltipTitles = new TooltipTitles() { Next = "Next page", Previous = "Previous page", Page = "Page {0}." },
                                Size = Size.normal,
                                Alignment = Alignment.centered,
                                IsShowControls = true,
                                IsShowFirstLast = true,
                                IsShowPages = true,
                                CssClass = ""
                            },
                            new AjaxOptions
                            {
                                UpdateTargetId = "listProduct",
                                OnBegin = "beginPaging",
                                OnSuccess = "myonsuccessCallServer",
                                OnFailure = "failurePaging"
                            }, new { controller = "Home", action = "New", id = Model.CategoryId }))
	                </ul>
                
                }
            </div>
     
    }
    else
    { 
            <div class="pr-head"><span>Không Có Tin Tức và Sự Kiện</span></div>
    }

}
else
{ 
    <div class="pr-head"><span>Không Có Tin Tức và Sự Kiện</span></div>
}



